package com.jt.www.model.correct;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jt.www.exception.ParamException;
import com.jt.www.model.entity.BaseEntity;
import com.jt.www.model.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Table;
import java.util.Date;


@Table(name = "t_correct_record")
public class CorrectRecordEntity extends BaseEntity implements BaseParam {
    /**
     * 冲正类型(一般性冲正、保费冲正、批单/保单删除)
     */
    @ApiModelProperty(value = "冲正类型(1 一般性冲正、2保费冲正、 3批单/保单删除)", required = true)
    private Integer correctType;

    /**
     * 1保单2批单3投保单
     */
    private Integer orderType;

    /**
     * 1待冲正、2冲正成功、3冲正失败
     */
    @ApiModelProperty(hidden = true)
    private Integer correctStatus;

    /**
     * 1待审核 3审核拒绝 4审核通过
     */
    @ApiModelProperty(hidden = true)
    private Integer approveStatus;

    /**
     * 冲正单号
     */
    @ApiModelProperty(value = "冲正单号 保单号/批单号", required = true)
    private String correctNo;

    /**
     * 冲正申请单号
     */
    @ApiModelProperty(value = "冲正申请单号 投保单号/批单申请号", required = true)
    private String correctApplyNo;


    /**
     * 冲正后内容
     */
    @ApiModelProperty(value = "冲正后内容", required = true)
    private String correctContent;

    /**
     * 冲正前内容
     */
    @ApiModelProperty(value = "冲正前内容", required = true)
    private String correctContentBack;

    /**
     * 创建人
     */
    @ApiModelProperty(hidden = true)
    private String createBy;

    /**
     * 创建人姓名
     */
    @ApiModelProperty(hidden = true)
    private String createByName;

    /**
     * 系统编码 教育
     */
    @ApiModelProperty(hidden = true)
    private String sysChannel;

    /**
     * 签单日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "签单日期", required = true)
    private Date signTime;

    /**
     * 投保起期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "投保起期", required = true)
    private Date startTime;

    /**
     * 投保止期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ApiModelProperty(value = "投保止期", required = true)
    private Date endTime;

    /**
     * 投保人名称
     */
    @ApiModelProperty(value = "投保人名称", required = true)
    private String policyHolder;

    /**
     * 被保人名称
     */
    @ApiModelProperty(value = "被保人名称", required = true)
    private String insured;

    /**
     * 保费
     */
    @ApiModelProperty(value = "保费", required = true)
    private String premium;


    //审核日期
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "审核日期")
    private Date toExamineTime;

    //审核人
    @ApiModelProperty(value = "审核人")
    private String toExamineUser;

    //审核人编码
    @ApiModelProperty(value = "审核人编码")
    private String toExamineUserCode;

    @ApiModelProperty(value = "分支机构编码")
    private String branchCode;
    /**
     * 流水号
     */
    @ApiModelProperty(value = "冲正流水号", hidden = true)
    private String serialNo;


    @ApiModelProperty(value = "冲正后的单号", hidden = true)
    private String correctNoAlter;

    @ApiModelProperty(value = "冲正后投保人", hidden = true)
    private String policyHolderAlter;

    @ApiModelProperty(value = "是否倒签：1-是；0-否")
    private Byte backLog;

    @ApiModelProperty(value = "是否跨期：1-是；0-否")
    private Byte crossTerm;

    @ApiModelProperty(value = "倒签原因：1-是；0-否")
    private String backlogReason;

    @ApiModelProperty(value = "收入确认时间点")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date incomeConfirmTime;

    @ApiModelProperty(value = "收入佐证原因")
    private String evidenceReason;

    @ApiModelProperty(value = "其他原因")
    private String otherReason;

    @ApiModelProperty(value = "佐证文件json")
    private String evidenceFile;

    @Override
    public void checkParam() throws ParamException {
        if (StringUtils.isBlank(correctNo)) {
            throw new ParamException("保单号/批单号 不能为空");
        }
        if (StringUtils.isBlank(correctApplyNo)) {
            throw new ParamException("投保单号/批单申请号 不能为空");
        }
        if (orderType == null || orderType < 1 || orderType > 2) {
            throw new ParamException("单据类型错误");
        }
        if (correctType == null || correctType < 1 || orderType > 3) {
            throw new ParamException("冲正类型错误");
        }
    }

    public Integer getCorrectType() {
        return correctType;
    }

    public void setCorrectType(Integer correctType) {
        this.correctType = correctType;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Integer getCorrectStatus() {
        return correctStatus;
    }

    public void setCorrectStatus(Integer correctStatus) {
        this.correctStatus = correctStatus;
    }

    public Integer getApproveStatus() {
        return approveStatus;
    }

    public void setApproveStatus(Integer approveStatus) {
        this.approveStatus = approveStatus;
    }

    public String getCorrectNo() {
        return correctNo;
    }

    public void setCorrectNo(String correctNo) {
        this.correctNo = correctNo;
    }

    public String getCorrectApplyNo() {
        return correctApplyNo;
    }

    public void setCorrectApplyNo(String correctApplyNo) {
        this.correctApplyNo = correctApplyNo;
    }

    public String getCorrectContent() {
        return correctContent;
    }

    public void setCorrectContent(String correctContent) {
        this.correctContent = correctContent;
    }

    public String getCorrectContentBack() {
        return correctContentBack;
    }

    public void setCorrectContentBack(String correctContentBack) {
        this.correctContentBack = correctContentBack;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateByName() {
        return createByName;
    }

    public void setCreateByName(String createByName) {
        this.createByName = createByName;
    }

    public String getSysChannel() {
        return sysChannel;
    }

    public void setSysChannel(String sysChannel) {
        this.sysChannel = sysChannel;
    }

    public Date getSignTime() {
        return signTime;
    }

    public void setSignTime(Date signTime) {
        this.signTime = signTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getPolicyHolder() {
        return policyHolder;
    }

    public void setPolicyHolder(String policyHolder) {
        this.policyHolder = policyHolder;
    }

    public String getInsured() {
        return insured;
    }

    public void setInsured(String insured) {
        this.insured = insured;
    }

    public String getPremium() {
        return premium;
    }

    public void setPremium(String premium) {
        this.premium = premium;
    }

    public Date getToExamineTime() {
        return toExamineTime;
    }

    public void setToExamineTime(Date toExamineTime) {
        this.toExamineTime = toExamineTime;
    }

    public String getToExamineUser() {
        return toExamineUser;
    }

    public void setToExamineUser(String toExamineUser) {
        this.toExamineUser = toExamineUser;
    }

    public String getToExamineUserCode() {
        return toExamineUserCode;
    }

    public void setToExamineUserCode(String toExamineUserCode) {
        this.toExamineUserCode = toExamineUserCode;
    }

    public String getBranchCode() {
        return branchCode;
    }

    public void setBranchCode(String branchCode) {
        this.branchCode = branchCode;
    }

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }

    public String getCorrectNoAlter() {
        return correctNoAlter;
    }

    public void setCorrectNoAlter(String correctNoAlter) {
        this.correctNoAlter = correctNoAlter;
    }

    public String getPolicyHolderAlter() {
        return policyHolderAlter;
    }

    public void setPolicyHolderAlter(String policyHolderAlter) {
        this.policyHolderAlter = policyHolderAlter;
    }

    public Byte getBackLog() {
        return backLog;
    }

    public void setBackLog(Byte backLog) {
        this.backLog = backLog;
    }

    public Byte getCrossTerm() {
        return crossTerm;
    }

    public void setCrossTerm(Byte crossTerm) {
        this.crossTerm = crossTerm;
    }

    public String getBacklogReason() {
        return backlogReason;
    }

    public void setBacklogReason(String backlogReason) {
        this.backlogReason = backlogReason;
    }

    public Date getIncomeConfirmTime() {
        return incomeConfirmTime;
    }

    public void setIncomeConfirmTime(Date incomeConfirmTime) {
        this.incomeConfirmTime = incomeConfirmTime;
    }

    public String getEvidenceReason() {
        return evidenceReason;
    }

    public void setEvidenceReason(String evidenceReason) {
        this.evidenceReason = evidenceReason;
    }

    public String getOtherReason() {
        return otherReason;
    }

    public void setOtherReason(String otherReason) {
        this.otherReason = otherReason;
    }

    public String getEvidenceFile() {
        return evidenceFile;
    }

    public void setEvidenceFile(String evidenceFile) {
        this.evidenceFile = evidenceFile;
    }
}
